<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .fa {
            /* width: 1000px;
            height: 500px;
            border: 3px solid rgb(188, 112, 247);
            transform: translate(50%,50%); */
            width: 800px;
            height: 500px;
            background: olivedrab;
            margin: 0 auto;
            /* 父相：父亲设置为相对定位 */
            position: relative;
        }
        .son {
            /* width: 500px;
            height: 300px;
            background: greenyellow;
            transform: translate(250px,100px); */
            width: 100px;
            height: 100px;
            background: lightcoral;
            /* 子绝：儿子设置绝对定位 */
            position: absolute;
            left: 50%;
            margin-left: -50px;
            top: 50%;
            margin-top: -50px;
        }
    </style>
</head>
<body>
    <div class="fa">
        <div class="son">儿子</div>
    </div>
</body>
</html>